home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 5.9 KB | 204 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWGC.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWGC_H
- #define FWGC_H
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWMAPING_H
- #include "FWMaping.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWAUTODE_H
- #include "FWAutoDe.h"
- #endif
-
- // ----- Platform Includes -----
-
- #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
- #include <windows.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CLASS_ATTR ODShape;
- class FW_CLASS_ATTR ODCanvas;
- class FW_CLASS_ATTR ODTransform;
- class FW_CLASS_ATTR FW_CRasterizer;
- class FW_CLASS_ATTR FW_CGraphicDevice;
-
- struct FW_CLASS_ATTR FW_SRasterizerState;
- struct FW_CLASS_ATTR FW_SSuspendResumeState;
- struct FW_CLASS_ATTR FW_SDeviceState;
-
- //========================================================================================
- // class FW_CGraphicContext
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CGraphicContext FW_AUTO_DESTRUCT_OBJECT
- {
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- virtual ~FW_CGraphicContext();
-
- protected:
- FW_CGraphicContext(Environment* ev);
-
- // ----- Init Graphic Context with a transform
- void InitGraphicContext(FW_CGraphicDevice* graphicDevice,
- ODTransform* transform,
- ODShape* clipShape);
-
- // ----- Terminate the Graphic Context
- void TerminateGraphicContext();
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Conversion -----
- FW_SPlatformPoint LogicalToDevice(FW_CFixed xSize, FW_CFixed ySize) const;
- FW_SPlatformPoint LogicalToDevice(const FW_CPoint& point) const;
- FW_SPlatformRect LogicalToDevice(const FW_CRect& rect) const;
- ODShape* LogicalToDevice(ODShape* shape) const;
-
- FW_CPoint DeviceToLogical(short xSize, short ySize) const;
- FW_CPoint DeviceToLogical(const FW_SPlatformPoint& point) const;
- FW_CRect DeviceToLogical(const FW_SPlatformRect& rect) const;
- ODShape* DeviceToLogical(ODShape* region) const;
-
- // ----- Clipping -----
- ODShape* GetClip() const; // the resulting shape belongs to the caller
- void SetClip(ODShape* odShape); // a copy of odShape is used
-
- void GetClipRect(FW_CRect& clipRect) const;
- void SetClipRect(const FW_CRect& clipRect);
-
- // ----- Mapping -----
- void SetMapping(const FW_CMapping& newMapping);
- void GetMapping(FW_CMapping& mapping) const;
-
- //----------------------------------------------------------------------------------------
- // Internal use only
- //
- public:
- // ----- Rasterizer -----
- FW_CRasterizer* GetRasterizer() const;
- void SetRasterizer(FW_CRasterizer *rasterizer);
-
- // ----- Transform info -----
- FW_SPlatformPoint GetOriginOffset() const;
-
- // ----- GraphicDevice -----
- FW_CGraphicDevice* GetGraphicDevice() const;
-
- // ----- Getters -----
- ODPlatformCanvas GetPlatformCanvas() const;
-
- // ----- Suspend/Resume -----
- void PrivSuspend();
- void PrivResume();
-
- Environment* GetEnvironment() const;
-
- private:
- FW_CGraphicContext(const FW_CGraphicContext& other);
- FW_CGraphicContext& operator=(const FW_CGraphicContext& other);
- // Copy constructor and assignment operator not valid for this class.
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- FW_Boolean fInitialized;
-
- Environment* fEnvironment;
-
- FW_CGraphicContext *fPreviousGraphicContext;
-
- FW_CMapping fMapping;
-
- FW_CRasterizer* fRasterizer;
- FW_CGraphicDevice* fGraphicDevice;
- ODTransform* fTransform;
-
- FW_SDeviceState* fDevicePreviousState;
- FW_SSuspendResumeState* fDeviceSuspendState;
- };
-
- //========================================================================================
- // class FW_CSaveRestoreContext
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CSaveRestoreContext FW_AUTO_DESTRUCT_OBJECT
- {
- public:
- FW_CSaveRestoreContext(FW_CGraphicContext& gc);
- virtual ~ FW_CSaveRestoreContext();
-
- private:
- FW_CGraphicContext& fGC;
- FW_SSuspendResumeState* fSuspendResume;
- };
-
- //========================================================================================
- // Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CGraphicContext::GetRasterizer
- //----------------------------------------------------------------------------------------
- inline FW_CRasterizer* FW_CGraphicContext::GetRasterizer() const
- {
- return fRasterizer;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CGraphicContext::GetGraphicDevice
- //----------------------------------------------------------------------------------------
- inline FW_CGraphicDevice* FW_CGraphicContext::GetGraphicDevice() const
- {
- return fGraphicDevice;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CGraphicContext::GetEnvironment
- //----------------------------------------------------------------------------------------
- inline Environment* FW_CGraphicContext::GetEnvironment() const
- {
- return fEnvironment;
- }
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-